<template>
    <div class="sidebar">
        <el-menu default-active="1-4-1" class="el-menu-vertical-demo" menu-trigger="click" router @open="handleOpen" @close="handleClose" :collapse="isCollapse">
            <el-menu-item index="index">
                <i class="el-icon-share"></i>
                <span slot="title">首页</span>
            </el-menu-item>

            <el-submenu index='1'>
                <template slot="title">
                    <i class="el-icon-message"></i>
                    <span slot="title">我的设备</span>
                </template>
                <el-menu-item index="/device_manager">
                    <i class="el-icon-setting"></i>
                    <span slot="title">设备管理</span>
                </el-menu-item>
                <el-menu-item index="/device_new">
                    <i class="el-icon-setting"></i>
                    <span slot="title">添加新设备</span>
                </el-menu-item>
                <el-menu-item index="/node_manager/1">
                    <i class="el-icon-setting"></i>
                    <span slot="title">管理数据节点</span>
                </el-menu-item>
            </el-submenu>

            <el-menu-item index="basetable">
                <i class="el-icon-more"></i>
                <span slot="title">管道维护</span>
            </el-menu-item>
            <el-menu-item index="4">
                <i class="el-icon-document "></i>
                <span slot="title">故障监控</span>
            </el-menu-item>

            <el-submenu index="5">
                <template slot="title">
                    <i class="el-icon-message"></i>
                    <span slot="title">系统设置</span>
                </template>
                <el-menu-item index="log">
                    <i class="el-icon-setting"></i>
                    <span slot="title">查看日志</span>
                </el-menu-item>
                <el-menu-item index="5-2">
                    <i class="el-icon-setting"></i>
                    <span slot="title">设备设置</span>
                </el-menu-item>
                <el-menu-item index="5-3">
                    <i class="el-icon-setting"></i>
                    <span slot="title">管道设置</span>
                </el-menu-item>
            </el-submenu>

        </el-menu>
    </div>
</template>

<style>
.el-menu-vertical-demo:not(.el-menu--collapse) {
    display: block;
    position: absolute;
    width: 200px;
    left: 0;
    top: 70px;
    bottom: 0;
}

.el-menu--collapse {
    display: block;
    position: absolute;
    left: 0;
    top: 70px;
    width:60px;
    bottom: 0;
}
</style>

<script>
export default {
    data() {
        return {
            isCollapse: false
        };
    },
    methods: {
        handleOpen(key, keyPath) {
            // console.log(key, keyPath);
        },
        handleClose(key, keyPath) {
            // console.log(key, keyPath);
        }
    }
}
</script>